<template>
  <div class="meitituiguang_fabu">
    <top></top>
    <div class="flex zhiboxitong_content">
      <div class="left">
        <left></left>
      </div>
      <div class="right">
        <div class="zhiboxitong_right" style="background: rgb(244, 244, 244);">
          <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/zhiboxitong/zhiboxiaoshou'}">直播销售</el-breadcrumb-item>
            <el-breadcrumb-item>媒体推广商品管理</el-breadcrumb-item>
            <el-breadcrumb-item>添加商品</el-breadcrumb-item>
          </el-breadcrumb>

          <div style="background: #fff; padding: 0 30px; box-shadow: 0px 4px 3px 0px rgba(0, 0, 0, 0.12); margin-top: 20px; padding-bottom: 30px;">
            <div class="fleft" style="position: relative; width: 100%;">

              <!-- <div style="position: absolute; right: 50px; top: 50px;" class="flexc">
                <div @click="yinyong" style="width: 174.78px;height: 36px; text-align: center; line-height: 36px; background: rgb(250, 252, 255);border: 1px solid rgb(68, 132, 255);border-radius:5px; color: rgb(68, 132, 255); cursor: pointer;">快速引用其他商品配置</div>
                <el-tooltip class="item" style="margin-left: 10px;" effect="dark" content="使用其他商品已编辑好的下单信息填写设置和下单限制设置及评论板块" placement="top-start">
                	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div> -->

              <div style="color: rgb(51, 51, 51); font-size: 20px; margin-bottom: 20px;">商品信息配置</div>
              <div class="flexc" style="margin-bottom: 20px;">
                <div class="z"><span class="red">*</span>选择商品:</div>
                <div class="r" >

                    <div class="flex" v-for="(item,index) in all.pages" :key="index" style="margin-bottom: 10px;">
                      <div><el-input v-model="item.page_name2" style="width: 220px; margin-right: 20px;" placeholder="请选择商品" disabled v-if="item.page_name2 != ''"></el-input> <el-button type="danger" size="medium" @click="log_shopxuanze(index)">选择商品</el-button></div>
                      <div style="margin-left: 20px;">商品名称：<el-input v-model="item.page_name" style="width: 220px;" placeholder="请输入商品名称" ></el-input></div>
                      <div style="margin-left: 20px;">售价：<el-input v-model="item.unit_price" style="width: 220px;" placeholder="请输入价格" ></el-input></div>
                      <div style="margin-left: 20px;"><el-button type="text" size="medium" @click="shanchuduo(index)">删除</el-button></div>
                    </div>
                    <div><el-button type="primary" size="medium" @click="all_pages_add">+添加套餐</el-button></div>

                </div>
              </div>

              <div class="flexc" style="margin-bottom: 20px;">
                <div class="z"><span class="red">*</span>商品名称:</div>
                <div class="r"><el-input v-model="all.sale_name" style="width: 220px;" placeholder="输入商品标题"></el-input></div>
              </div>
              <div class="flexc" style="margin-bottom: 20px;"  v-if="!$route.query.tab">
                <div class="z"><span class="red">*</span>订单来源:</div>
                <div class="r"><el-input v-model="all.page_source" style="width: 220px;" placeholder="请输入订单来源"></el-input></div>
                <el-tooltip class="item" effect="dark" content="在订单来源中显示，用于区分下单来源，例如：某某推广渠道" placement="top-start">
                	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div>

              <!-- <div class="flexc" style="margin-bottom: 20px;"  v-if="$route.query.tab">
                <div class="z"><span class="red">*</span>商品主图:</div>
                <div class="r">
                  <chuantu ref="chuantu" v-if="relo" @getimg="getimg" :imgs="all.pic" widths="100px" heights="100px"></chuantu>
                </div>
              </div>
              <div class="flexc" style="margin-bottom: 20px;"  v-if="$route.query.tab">
                <div class="z"><span class="red">*</span>分享海报图
              （分享引用）:</div>
                <div class="r">
                  <chuantu ref="chuantu" v-if="relo" @getimg="getimg3" :imgs="all.market_pic" widths="100px" heights="100px"></chuantu>
                </div>
              </div>

              <div class="flexc youse" style="margin-bottom: 20px;" v-if="$route.query.tab">
                <div class="z">下单按钮名称：</div>
                <div class="r"><el-input v-model="all.order_button" style="width: 220px;" placeholder="请输入下单按钮名称"></el-input></div>
                <el-tooltip class="item" effect="dark" content="例如免费领取、立刻抢购、提交订单等，不超过6个字" placement="top-start">
                  <i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div>
              <div class="flexc youse" style="margin-bottom: 20px;" v-if="$route.query.tab">
                <div class="z">提醒注意点：</div>
                <div class="r"><el-input v-model="all.tips" style="width: 220px;" placeholder="请输入提醒注意点"></el-input></div>
                <el-tooltip class="item" effect="dark" content="例如年龄限制，地域限制等提醒信息，不设置不会显示" placement="top-start">
                  <i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div>
              <div class="flexc youse" style="margin-bottom: 20px;" v-if="$route.query.tab">
                <div class="z">卖点：</div>
                <div class="r"><el-input v-model="all.sell_point2[0]" style="width: 110px; margin-right: 20px;" placeholder="请输入卖点"></el-input></div>
                <div class="r"><el-input v-model="all.sell_point2[1]" style="width: 110px; margin-right: 20px;" placeholder="请输入卖点"></el-input></div>
                <div class="r"><el-input v-model="all.sell_point2[2]" style="width: 110px; margin-right: 20px;" placeholder="请输入卖点"></el-input></div>
                <div class="r"><el-input v-model="all.sell_point2[3]" style="width: 110px; margin-right: 20px;" placeholder="请输入卖点"></el-input></div>
                <el-tooltip class="item" effect="dark" content="最多支持4个卖点展示，单个卖点建议4个字，最大不超过15个字" placement="top-start">
                  <i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div>
              <div class="flexc youse" style="margin-bottom: 20px;">
                <div class="z"><span class="red">*</span>售价：</div>
                <div class="r"><el-input v-model="all.price" style="width: 220px;" placeholder="请输入售价"></el-input></div>
                <el-tooltip class="item" effect="dark" content="不填或填写0表示无需支付" placement="top-start">
                  <i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>

                <div class="z" v-if="$route.query.tab">原价：</div>
                <div class="r" v-if="$route.query.tab"><el-input v-model="all.origin_price" style="width: 220px;" placeholder="请输入售价"></el-input></div>
                <el-tooltip v-if="$route.query.tab" class="item" effect="dark" content="原价为画横线价格，仅渲染氛围" placement="top-start">
                  <i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div>
              <div class="flexc youse" style="margin-bottom: 20px;" v-if="$route.query.tab">
                <div class="z">展示已有销量：</div>
                <div class="r"><el-input v-model="all.saled_amount" style="width: 220px;" placeholder="请输入展示已有销量"></el-input></div>
                <el-tooltip class="item" effect="dark" content="商品陈列处展示，不设置不会显示" placement="top-start">
                  <i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div> -->
            </div>
          </div>

          <div style="background: #fff; padding: 20px 30px; margin-top: 20px; box-shadow: 0px 4px 3px 0px rgba(0, 0, 0, 0.12);">
            <div style="color: rgb(51, 51, 51); font-size: 20px; margin: 40px 0 30px 0;">商品下单页配置</div>

            <div class="flexc" style="margin-bottom: 20px;">
              <div class="z" style="width: 170px;">下单页头图:</div>
              <div class="r">
                <chuantu ref="chuantu" v-if="relo" @getimg="getimg2" :imgs="all.details"  widths="100px" heights="100px"></chuantu>
              </div>
            </div>

            <div class="flexc" style="margin-bottom: 20px;">
              <div class="z" style="width: 170px;">选择主题:</div>
              <div class="r">
                <div style="background: rgb(227, 238, 250);border: 1px solid rgb(39, 120, 253);border-radius:3px; color: rgb(39, 120, 253); width: 90px; line-height: 32px; text-align: center; cursor: pointer;" @click="yanseshow">{{all2.yansename}}</div>
              </div>
            </div>

            <div class="flexc" style="margin-bottom: 20px;">
              <!-- <div class="z" style="width: 170px;">内容填写背景色：</div>
              <div class="r" style="margin-right: 20px;"><el-color-picker v-model="all2.neirongcolor" show-alpha></el-color-picker></div>

              <div class="z" style="width: 170px;">提单按钮颜色：</div>
              <div class="r" style="margin-right: 20px;"><el-color-picker v-model="all2.anniucolor" show-alpha></el-color-picker></div>
 -->
              <div class="z" style="width: 170px;">提单按钮文字：</div>
              <div class="r"><el-input v-model="all2.anniuwenzi" style="width: 220px;" placeholder="请输入提单按钮文字"></el-input></div>
            </div>

            <div class="flexc" style="margin-bottom: 20px;">
              <div class="z" style="width: 170px;">入网协议展示:</div>
              <div class="r">
                <el-switch  style="display: block"  v-model="all.network_access_protocol" @change="shifouxianshixieyi2" active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)" active-value="1" inactive-value="0"></el-switch>
              </div>
            </div>

            <div class="flexc" style="margin-bottom: 20px;" v-if="all.network_access_protocol == 1">
              <div class="z" style="width: 170px;">选择协议:</div>
              <div class="r flexc">
                <el-select class="youse" v-model="all.protocol_id" @change="shifouxianshixieyi" clearable filterable multiple collapse-tags  placeholder="请选择要展示的协议" v-if="all.network_access_protocol == 1">
                  <el-option v-for="item in xieyilist" :key="item.id" :label="item.title" :value="item.id"></el-option>
                </el-select>

                <router-link class="b_nav" style="margin-left: 20px;" to="/zhiboxitong/ruwangxieyi">
                  <el-button type="text">管理协议</el-button>
                </router-link>
                <!-- <div style="margin-left: 20px;">用户默认勾选</div> -->
                <!-- <el-checkbox style="margin-left: 20px;" v-model="all.protocol_check"></el-checkbox>

                <el-tooltip class="item" effect="dark" content="使用默认勾选后用户下单时无需勾选,此操作不合规,请谨慎使用" placement="top-start">
                	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip> -->
              </div>
            </div>
            <div class="flexc" style="margin-bottom: 20px;" v-if="all.network_access_protocol == 1">
              <div class="z" style="width: 170px;">协议设置:</div>
              <div class="r flexc">
                <el-select class="youse" v-model="all.protocol_check"   @change="choosexyset"  placeholder="请选择要展示的协议" v-if="all.network_access_protocol == 1">
                  <el-option   :value="2" label="用户需勾选同意协议才能下单"></el-option>
                  <el-option   :value="1" label="默认替用户勾选同意协议"></el-option>
                  <el-option   :value="3" label="用户不勾选同意协议也可下单"></el-option>
                </el-select>
                <el-checkbox style="margin-left: 20px;" v-model="all2.protocol_qz"></el-checkbox>
                <div style="margin-left: 5px;">用户勾选同意时强制展示协议内容</div>
              </div>
            </div>

            <div class="flexc" style="margin-bottom: 20px;">
              <div class="z" style="width: 170px;">
                下单页详情:
              </div>
              <div class="r">
                  <fuwenben :description="all.description" @fuwenbenfanhui="fuwenbenfanhui" v-if="fuwenbenshow"></fuwenben>
              </div>
            </div>
          </div>


          <div style="background: #fff; padding: 20px 30px; margin-top: 20px; box-shadow: 0px 4px 3px 0px rgba(0, 0, 0, 0.12);">

            <div style="color: rgb(51, 51, 51); font-size: 20px; margin: 40px 0 30px 0;">商品下单信息填写配置</div>
            <div class="xialeft">
              <div class="flexc" style="margin-bottom: 20px;">
                <div class="z" style="width: 170px;">身份证信息填写:</div>
                <div class="r">
                  <el-switch  style="display: block"  v-model="all2.needidcard" @change="isneedcard" active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)" active-value="1" inactive-value="2"></el-switch>
                </div>
              </div>
              <div class="flexc" style="margin-bottom: 20px;">
                <div class="z" style="width: 170px;">收货人使用身份证姓名:</div>
                <div class="r">
                  <el-switch  style="display: block"  v-model="all2.shouhuorenxingming" active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)" active-value="true" inactive-value="false"></el-switch>
                </div>
                <el-tooltip class="item" effect="dark" content="强制收件人为办理人本人，用户不在需要填写收货人" placement="top-start">
                	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
              </div>
              <div class="flexc" style="margin-bottom: 20px;">
                <div class="z" style="width: 170px;">身份证照片上传:</div>
                <div class="r">
                  <el-switch  style="display: block"  v-model="all2.shenfenzheng"  active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)" active-value="true" inactive-value="false"></el-switch>
                </div>
                <div style="color: rgb(126, 126, 126); font-size: 12px; margin-left: 10px;" v-if="all2.shenfenzheng">提示：检测到当前选择的商品需要照片</div>

              </div>

              <div class="flexc" style="margin-bottom: 50px;">
                <div class="z" style="width: 170px;">提单信息填写展示方式:</div>
                <div class="r flexc">
                  <div style="margin-right: 10px;"><el-radio v-model="all2.xiantianxie" label="2">逐渐显示填写信息</el-radio></div>
                  <el-tooltip class="item" effect="dark" content="先显示姓名电话，填写完成后再显示其他填写项" placement="top-start">
                  	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                  </el-tooltip>
                  <div style="margin-left: 30px;"><el-radio v-model="all2.xiantianxie" label="1">直接列出全部填写信息</el-radio></div>
                  <el-tooltip class="item" effect="dark" content="直接给用户列出所有要填写的下单信息" placement="top-start">
                  	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                  </el-tooltip>
                </div>
              </div>
              <div style="height: 1px; width: 100%; background: rgb(208, 208, 208);"></div>

              <div style="color: rgb(51, 51, 51); font-size: 20px; margin: 50px 0 50px 0;">用户下单限制设置</div>
              <div class="flexc" style="margin-bottom: 20px;">
                <div class="z" style="width: 170px;">下单年龄限制：</div>
                <div class="r">
                  <el-switch  style="display: block"  v-model="all2.needage" active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)"></el-switch>
                </div>
              </div>
              <div class="flexc" style="margin-bottom: 20px;" v-if="all2.needage">
                <div class="z" style="width: 170px;">允许下单的年龄范围：</div>
                <div class="r">
                  <div class="flexc">
                    <el-input v-model="all2.min_page" style="width: 120px; margin-right: 10px;" placeholder="选择最小年龄"></el-input>
                    ——
                    <el-input v-model="all2.max_page" style="width: 120px; margin:0 10px;" placeholder="选择最大年龄"></el-input>
                  </div>
                </div>
              </div>
              <div class="flexc" style="margin-bottom: 20px;">
                <div class="z" style="width: 170px;">下单数量限制：</div>
                <div class="r">
                  <el-switch  style="display: block"  v-model="all2.xiadanshuliang" @change="xuanzeshuliang2" active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)" ></el-switch>
                </div>
              </div>
              <div class="flexc" style="margin-bottom: 20px;" v-if="all2.xiadanshuliang">
                <div class="z" style="width: 170px;">选择限制数量：</div>
                <div class="r">
                      <el-select v-model="all.limit"  @change="xuanzeshuliang" placeholder="选择已有的直播页">
                        <!-- <el-option label="不限制" :value="0"></el-option> -->
                        <el-option v-for="item in 9" :key="item" :label="item" :value="item"></el-option>
                      </el-select>
                </div>
                <div class="z" style="width: 170px;" v-if="all2.needidcard=='1'||all2.needidcard=='2'">识别方式选择：</div>
                <div class="r">
                      <el-select v-model="limit_type1" style="margin-left: 20px;" placeholder="识别方式选择：" v-if="all2.needidcard=='1'">
                        <el-option label="按照身份证识别" :value="0"></el-option>
                        <el-option label="按照手机号识别" :value="1"></el-option>
                        <el-option label="按照IP地址识别" :value="2"></el-option>
                      </el-select>
                      <el-select v-model="limit_type2" style="margin-left: 20px;" placeholder="识别方式选择：" v-if="all2.needidcard=='2'">
                        <el-option label="按照手机号识别" :value="1"></el-option>
                        <el-option label="按照IP地址识别" :value="2"></el-option>
                      </el-select>
                      <span v-if="limit_type2 == 2 || limit_type1 == 2" style="color: #999; margin-left: 10px;">如果投放页面的环境无法获取用户IP，此限制将会失效。</span>
                </div>
              </div>
              <div class="flex" style="margin-bottom: 20px;">
                <div class="z" style="width: 170px;">不发货地区设置：</div>
                <div class="r">
                  <div class="flexc" style="padding-bottom: 20px;">
                    <div style="margin-right: 20px;"><el-radio v-model="all2.bufahuodiqu" label="2">使用产品的不发货区域</el-radio></div>
                    <div style="margin-right: 20px;"><el-radio v-model="all2.bufahuodiqu" label="1">设置只发货区域</el-radio></div>
                    <div><el-radio v-model="all2.bufahuodiqu" label="3">设置不发货区域</el-radio></div>
                  </div>
                  <div style="background: rgb(241, 241, 241); padding-bottom: 20px;" v-if="all2.bufahuodiqu == 1">
                    <div style="color: #999; font-size: 12px; padding: 10px 23px;">设置后用户只能选择选中的省市为收货地址</div>
                    <div style="padding-left: 23px;">
                        <el-cascader :options="options" v-model="all2.delivery_city" style="width: 400ox;" collapse-tags :props="props" clearable>
                        </el-cascader>
                    </div>
                  </div>
                  <div style="background: rgb(241, 241, 241); padding-bottom: 20px;" v-if="all2.bufahuodiqu == 3">
                    <div style="color: #999; font-size: 12px; padding: 10px 23px;">设置后用户不能选择选中的省市为收货地址</div>
                    <div style="padding-left: 23px;">
                        <el-cascader ref="test" :options="options" v-model="all2.no_city" style="width: 400ox;" collapse-tags :props="props" clearable @change="test" >
                        </el-cascader>
                    </div>
                  </div>
                  <div style=" background: rgb(241, 241, 241); padding:0 20px;"  v-if="all2.bufahuodiqu == 1 || all2.bufahuodiqu == 3">
                    <div class="flexc">
                      <div style="line-height: 32px;">批量上传地址</div>
                      <div style="margin-left: 20px;">
                        <el-upload :show-file-list="false"  action="https://jsonplaceholder.typicode.com/posts/" :http-request="upup">
                          <el-button size="small" type="text">上传不发货地址</el-button>
                        </el-upload>
                      </div>
                    </div>
                    <el-button type="text" @click="down" >模板下载</el-button>
                  </div>

                </div>
              </div>
              <div class="flexc" style="margin-bottom: 10px;">
                <div>身份证信息国政通效险（付费0.2元/条）：</div>
                <div class="r">
                  <el-switch  style="display: block"   v-model="all2.guozhengtong"  active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)" ></el-switch>
                </div>
              </div>
              <div style="margin-bottom: 20px; color: rgb(127, 127, 127); font-size: 12px;">用户填写的身份证信息需经过国政通效险后才可通过，敢探号余额不足后将不会再验证身份证信息，用户可正常下单</div>
              <div class="flexc" style="margin-bottom: 10px;">
                <div>联系电话验证码校验（付费5分/条）：</div>
                <div class="r flexc">
                  <el-switch  style="display: block" v-model="all2.duanxin"  active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)" ></el-switch>

                  <div class="flexc" style="margin-left: 50px;">
                    <div>请选择签名：</div>
                    <div class="r">
                      <el-select v-model="all.sign" style="margin-left: 20px;" placeholder="识别方式选择：" >
                        <el-option :label="item.name" :value="item.id" v-for="item in signlist" :key="item.id"></el-option>
                      </el-select>
                    </div>
                  </div>
                </div>
              </div>
              <div style="margin-bottom: 50px; color: rgb(127, 127, 127); font-size: 12px;">提醒：验证码有小概率会出现部分用户收不到的情况</div>

              <div style="height: 1px; width: 100%; background: rgb(208, 208, 208);"></div>

              <div class="flexc" style="height: 80px; margin-top: 50px;">
                <div style="color: rgb(51, 51, 51); font-size: 20px; ">评论板块</div>
                <el-tooltip style="margin-left: 10px;" class="item" effect="dark" content="直接给用户列出所有要填写的下单信息" placement="top-start">
                	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip>
                <el-switch  style="display: block;margin-left: 10px;"   v-model="all2.pinglun"  active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)"  active-value="1" inactive-value="0" ></el-switch>
              </div>
              <div class="flexc" v-if="all2.pinglun == 1">
                <div>
                  <el-select v-model="all2.pinglunid" placeholder="请选择评论模板">
                    <el-option v-for="item in pinglunlist" :key="item.id" :label="item.title" :value="item.id"></el-option>
                  </el-select>
                </div>
                <div @click="go('/zhiboxitong/pinglunguanli')" style="margin-left: 20px; cursor: pointer; color: rgb(50, 85, 255);">管理评论模板</div>
              </div>
              <div class="flexc" style="height: 80px; ">
                <div style="color: rgb(51, 51, 51); font-size: 20px; ">领取播报模块</div>
                <!-- <el-tooltip style="margin-left: 10px;" class="item" effect="dark" content="由商家自行导入评价内容,在下单滚动显示" placement="top-start">
                	<i class="el-icon-question" style="color: rgb(196, 196, 196); font-size: 25px; margin-left: 5px; cursor: pointer;" ></i>
                </el-tooltip> -->
                <el-switch  style="display: block;margin-left: 10px;"   v-model="all2.gm"  active-color="rgb(71, 140, 253)"  inactive-color="rgb(69, 69, 69)"  active-value="1" inactive-value="0" ></el-switch>
              </div>
            </div>
          </div>

          <div style="height: 100px;" class="flexcc">
            <el-button type="danger" size="medium" @click="fabu()">下一步</el-button>
          </div>
        </div>

      </div>
    </div>

    <el-dialog title="根据已有直播页发布页面" :visible.sync="log" :close-on-click-modal="false" width="700px">
      <div class="flex">
        <el-select v-model="tongbuall" placeholder="选择已有的直播页">
         <el-option v-for="item in list" :key="item.value" :label="item.name" :value="item.value"></el-option>
        </el-select>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="log = false">取消</el-button>
        <el-button type="primary" @click="tongbugo">确认</el-button>
      </span>
    </el-dialog>

    <el-dialog title="选择商品" :visible.sync="log_shop" width="700px">
      <div>
        <div class="flex">
          <el-input v-model="shopsearch.title" style="width: 180px; margin-right:20px;" placeholder="请输入商品名称"></el-input>
          <el-input v-model="shopsearch.fetch_code" style="width: 180px; margin-right:20px;" placeholder="请输入商品编码"></el-input>
          <el-button type="danger" @click="getshops()">搜索</el-button>
        </div>
        <div style="height: 600px; overflow: auto;">

          <div class="flexbc" v-for="item in shoplists" :key="item.id" style="border: 1px #eaeaea solid; padding:10px 20px; margin-top:10px;">
            <div class="flexc">
              <div style="margin-right: 20px;">
                <img :src="item.image1"  style="width: 100px; height:100px;">
              </div>
              <div style="margin-right: 20px;">
                <div style="margin-bottom: 10px; font-weight: bold;">{{item.title}}
                  <el-button type="warning" style="margin-left: 20px;" size="mini" v-if="item.take_number == 1 && item.mobile_config == 1">归属地选号</el-button>
                  <el-button type="warning" style="margin-left: 20px;" size="mini" v-if="item.take_number == 1 && item.mobile_config == 2">支持选号</el-button>
                </div>
                <div style="margin-bottom: 10px;">编码：{{item.fetch_code}}</div>
                <div style="margin-bottom: 10px;">创建时间：{{item.created_at}}</div>
              </div>
            </div>

            <div>
              <el-button type="danger" @click="xuanzhong(item)">选择商品</el-button>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="log_shop = false">取消</el-button>
      </span>
    </el-dialog>
    <fuzhishangpinxinxi @fuzhishangpinxinxi2="fuzhishangpinxinxi2" v-if="fuzhishangpinxinxilog" ref="fuzhishangpinxinxi"></fuzhishangpinxinxi>
    <yansexuanze @yansexuanze="yansexuanze" :yansename="all2.yansename" :yuanjiaoa="all2.yuanjiao" ref="yansexuanze" v-if="yansexuanzelog"></yansexuanze>
  </div>
</template>

<script>
	import {tongyidizhi} from '../common/tongyidiqu.js'
import * as qiniu from 'qiniu-js'
  import axios from "axios";
  import top from "./components/top.vue";
  import left from "./components/left.vue";
  import chuantu from "../components/chuantu.vue";
  import {bufahuodiqu} from '../assets/bufahuodiqu.js'
  import fuwenben from "../components/fuwenben.vue";
  import yansexuanze from "./meitituiguanglog/yansexuanze.vue";
  import fuzhishangpinxinxi from "./meitituiguanglog/fuzhishangpinxinxi.vue";
  export default {
    components: {
      top,left,chuantu,fuwenben,yansexuanze,fuzhishangpinxinxi
    },
    name: "meitituiguang_fabu",
    data() {
      return {
          fuzhishangpinxinxilog:false,
          fuzhixinxi:false,
          list:"",
          tongbuall:"",
          log:false,
          log_shop:false,
          input:"",
          all_pages_index:"",
          all:{
            pages:[],
            tab:this.$route.query.tab || 0,
            page_id:"",//	613552	是	string	敢探号商品id
            json:"",//		是	string	无
            sale_name:"",//	wq29元1	是	string	销售商品名
            on_sale:0,//		是	string	在售
            price:"",//	11	是	string	价格
            pic:"",//		是	string	图片
            details:"",//		是	string	详情
            order:0,//		是	string	无
            delivery_area:"",//		是	string	无
            delivery_city:"",//		是	string	无
            id:this.$route.query.id?this.$route.query.id:'',//	1	否	string	修改用
            page_name:"",
            page_source:"",
            limit:0,
            limit_type:"",
            description:"",
            network_access_protocol:0,
            protocol_id:[],
            protocol_check:2,
            order_button:"立刻办理",
            tips:"",
            sell_point:["","","",""],
            sell_point2:["","","",""],
            origin_price:0,
            sign:""
          },
          xieyilist:"",
          yansexuanzelog:false,
          all2: {
            yuanjiao:1,
            xiadanshuliang:false,
            needage:false,
            guozhengtong:false,
            zuidaxiadan:false,
            duanxin:false,
            shouhuorenxingming:false,
            shenfenzheng:false,
            bufahuodiqu:'2',
            delivery_city:"",
            no_city:"",
            bufahuosheng:[],
            xiantianxie:"1",
            needidcard:"1",
            ruwangxieyi:"0",
            gongsiming:"",
            gongsidizhi:"",
            gongsidianhua:"",
            dingdanzhuangtai:'0',
            kuaishou:"",
            pinglun:"0",
            pinglunid:"",
            neirongcolor:"rgb(157, 111, 255)",
            anniucolor:"rgb(255, 64, 33)",
            anniuwenzi:"0元领取  包邮到家",
            yansename:"紫色",
            yueduyanse:"rgb(66, 6, 93)",
            protocol_qz:false,
            gm:'',
            shangchuanneirongma:false,
            shangchuanneirong:""
          },
          shoplists:"",
          shopsearch:{
            title:"",
            fetch_code:""
          },

          radio:'1',
          options:[],
          props: {
            multiple: true
          },
          relo:true,
          limit_type1:0,
          limit_type2:1,
          chanpinxixi:"",
          xiaozi:false,
          log_shop2:false,
          signlist:[]
      }
    },
    created() {
      console.log(this.all2.needidcard)
      console.log(this.all2)

      this.getshangpinfenlei()
      this.getsign()
      console.log(this.all2.needidcard)
    },
    async mounted() {
      await this.getshops()
      this.options = bufahuodiqu
      // this.options = tongyidizhi


      if(this.$route.query.id){
        let p = new Promise((res,rej)=>{
          axios.get(`${this.apis}/api/page/info2?id=${this.$route.query.id}`)
          	.then(response => {
          		if (response.data.msg.code == 0) {


                if(response.data.data.sell_point != null && response.data.data.sell_point){
                  let arr = ["","","",""]
                  if(JSON.parse(response.data.data.sell_point)[0]){
                    arr[0] = JSON.parse(response.data.data.sell_point)[0]
                  }
                  if(JSON.parse(response.data.data.sell_point)[1]){
                    arr[1] = JSON.parse(response.data.data.sell_point)[1]
                  }
                  if(JSON.parse(response.data.data.sell_point)[2]){
                    arr[2] = JSON.parse(response.data.data.sell_point)[2]
                  }
                  if(JSON.parse(response.data.data.sell_point)[3]){
                    arr[3] = JSON.parse(response.data.data.sell_point)[3]
                  }
                  response.data.data.sell_point = arr
                  response.data.data.sell_point2 = arr
                }else{
                  response.data.data.sell_point = ["","","",""]
                  response.data.data.sell_point2 = ["","","",""]
                }

          			this.all = response.data.data
                if(!this.all.origin_price){
                  this.all.origin_price = 0
                }
                if(this.all.description == null){
                  this.all.description = ""
                }
                if(this.all.origin_price == null){
                  this.all.origin_price = 0
                }


                if(!this.all.protocol_check){
                    this.all.protocol_check = 2

                  }
                if(this.all.protocol_id != ''){
                  this.all.protocol_id = this.all.protocol_id.map(Number)
                   console.log(this.all.protocol_id)
                }

                this.limit_type1 = this.all.limit_type
                this.limit_type2 = this.all.limit_type

                this.$set(this.all,'temp_id',0)

                if(this.all.pages && this.all.pages != ''){
                  this.all.pages.forEach(item=>{
                    this.shoplists.forEach(item2=>{
                      if(item.page_id == item2.id){
                        this.$set(item,'page_name2',item2.title)
                      }
                    })
                  })
                }

                this.relo = false
                this.$nextTick(()=>{
                  this.relo = true
                })
                this.fuwenbenshow = true

                if(this.all.limit == 0){
                  this.all.xiadanshuliang = false
                }else{
                  this.all.xiadanshuliang = true
                }

                if(this.all.protocol_id != 0){
                  this.all.network_access_protocol = "1"
                }


                let wenjianjia = 'web-page'
                if(process.env.NODE_ENV === 'development'){
                  // wenjianjia = 'test-web-page'
                }

                if(window.location.href.includes('storep.91haoka.cn') && this.apis == ''){
                	wenjianjia = 'web-page'
                }
                if(window.location.href.includes('store.91haoka.cn') && this.apis == ''){
                	wenjianjia = 'test-web-page'
                }
                if(window.location.href.includes('localhost')){
                  wenjianjia = 'test-web-page'
                }

                axios.get(`https://file.91haoka.cn/${wenjianjia}/${this.$route.query.id}.json?v=${Math.random()}`)
                // axios.get(`${this.apis}/storage/web-page/${this.$route.query.id}.json?v=${Math.random()}`)
                  .then(response2 => {

                      this.all2 = JSON.parse(response2.data)

                      this.yansexuanzelog = true
                      if(!this.all2.yansename){
                        this.all2.neirongcolor = "rgb(157, 111, 255)"
                        this.all2.anniucolor = "rgb(255, 64, 33)"
                        this.all2.anniuwenzi = "0元领取  包邮到家"
                        this.all2.yansename = "紫色"
                        this.all2.yueduyanse = "rgb(66, 6, 93)"
                      }

                      if(this.all2.needidcard==undefined){
                        this.$set(this.all2, 'needidcard', '1')
                      }
                      // this.getchanpinxixi(response.data.data.page_id)
                      res('ok')
                  })

          		} else {
          			this.$message.error(response.data.msg.info);
          		}
          	})
        })
        p.then(res=>{

          if(this.all2.pinglunid){
            let arr = []
            for(let i in this.pinglunlist){
              arr.push(this.pinglunlist[i].id)
            }
            if(!arr.includes(this.all2.pinglunid)){
              this.all2.pinglunid = ''
            }
          }
        })

      }else{
        this.fuwenbenshow = true
      }


    },
    methods: {
      getsign:function(){

        axios.get(`${this.apis}/api/sms/message/sign`)
          .then(response => {
            if(response.data.msg.code == 0){
              this.signlist = response.data.data
            }else{
              this.$message.error(response.data.msg.info);
            }
          });
      },
      xuanzhong:function(item){
        this.yansexuanzelog = true
        let x = this.all.pages.filter(itemx => item.id == itemx.page_id)
        console.log(x)
        if(x != ''){
          this.$message.error('不能添加重复商品');
          return false
        }
        this.all.pages[this.all_pages_index].page_id = item.id
        this.all.pages[this.all_pages_index].page_name2 = item.title
        this.log_shop = false
      },
      shanchuduo:function(indexs){
        this.all.pages = this.all.pages.filter((item,index)=> index != indexs)

      },
      all_pages_add:function(){
        this.all.pages.push({
          page_id:"",
          page_name2:"",
          page_name:"",
          unit_price:""
        })
      },
      log_shopxuanze:function(index){
        this.all_pages_index = index
        this.log_shop = true
      },
      yinyong:function(){
        this.fuzhishangpinxinxilog = true
        this.$nextTick(()=>{
          this.$refs.fuzhishangpinxinxi.log = true
        })
      },
      fuzhishangpinxinxi2:function(val){
        this.fuzhishangpinxinxilog = false
        //获取到id
        var all2 = ""
        let p = new Promise((res,rej)=>{
          axios.get(`${this.apis}/api/page/info/manage?id=${val}`)
          	.then(response => {
          		if (response.data.msg.code == 0) {
                if(response.data.data.sell_point != null && response.data.data.sell_point){
                  let arr = ["","","",""]
                  if(JSON.parse(response.data.data.sell_point)[0]){
                    arr[0] = JSON.parse(response.data.data.sell_point)[0]
                  }
                  if(JSON.parse(response.data.data.sell_point)[1]){
                    arr[1] = JSON.parse(response.data.data.sell_point)[1]
                  }
                  if(JSON.parse(response.data.data.sell_point)[2]){
                    arr[2] = JSON.parse(response.data.data.sell_point)[2]
                  }
                  if(JSON.parse(response.data.data.sell_point)[3]){
                    arr[3] = JSON.parse(response.data.data.sell_point)[3]
                  }
                  response.data.data.sell_point2 = arr
                }else{
                  response.data.data.sell_point2 = ["","","",""]
                }

          			let all = response.data.data

                if(!all.origin_price){
                  all.origin_price = 0
                }

                let obj = JSON.parse(all.json)
                all.yuezu = obj.yuezu
                all.liuliang = obj.liuliang
                all.taocan = obj.taocan
                all.yuyin = obj.yuyin
                if(!all.protocol_check){
                  all.protocol_check = 2
                }
                if(all.protocol_id != ''){
                  all.protocol_id = all.protocol_id.map(Number)
                   console.log(all.protocol_id)
                }

                this.limit_type1 = all.limit_type
                this.limit_type2 = all.limit_type

                this.$set(all,'temp_id',0)

                this.relo = false
                this.$nextTick(()=>{
                  this.relo = true
                })
                this.fuwenbenshow = true

                if(all.limit == 0){
                  all.xiadanshuliang = false
                }else{
                  all.xiadanshuliang = true
                }

                if(all.protocol_id != 0){
                  all.network_access_protocol = "1"
                }

                this.all.page_id = all.page_id
                this.all.temp_id = all.temp_id
                this.all.cat_id = all.cat_id
                this.all.p_details = all.p_details
                this.all.json = all.json
                this.all.on_sale = all.on_sale
                this.all.price = all.price
                this.all.order = all.order
                this.all.delivery_area = all.delivery_area,//		是	string	无
                this.all.delivery_city = all.delivery_city,//		是	string	无
                this.all.page_name = all.page_name
                this.all.page_source = all.page_source
                this.all.limit = all.limit
                this.all.limit_type = all.limit_type
                this.all.network_access_protocol = all.network_access_protocol
                this.all.protocol_id = all.protocol_id
                this.all.protocol_check = all.protocol_check
                this.all.order_button = all.order_button
                this.all.tips = all.tips
                // this.all.sell_point = all.sell_point
                // this.all.sell_point2 = all.sell_point2
                this.all.origin_price = all.origin_price


                let wenjianjia = 'web-page'
                if(process.env.NODE_ENV === 'development'){
                  // wenjianjia = 'test-web-page'
                }

                if(window.location.href.includes('storep.91haoka.cn') && this.apis == ''){
                	wenjianjia = 'web-page'
                }
                if(window.location.href.includes('store.91haoka.cn') && this.apis == ''){
                	wenjianjia = 'test-web-page'
                }
                if(window.location.href.includes('localhost')){
                  wenjianjia = 'test-web-page'
                }

                axios.get(`https://file.91haoka.cn/${wenjianjia}/${val}.json?v=${Math.random()}`)
                  .then(response2 => {
                      all2 = JSON.parse(response2.data)
                      console.log(all2)
                      if(!all2.yansename){
                        all2.neirongcolor = "rgb(157, 111, 255)"
                        all2.anniucolor = "rgb(255, 64, 33)"
                        all2.anniuwenzi = "0元领取  包邮到家"
                        all2.yansename = "紫色"
                        all2.yueduyanse = "rgb(66, 6, 93)"
                      }
                      if(all2.needidcard==undefined){
                        this.$set(all2, 'needidcard', '1')
                      }
                      this.getchanpinxixi(response.data.data.page_id)
                      res('ok')
                  })
          		} else {
          			this.$message.error(response.data.msg.info);
          		}
          	})
        })
        p.then(res=>{
          if(all2.pinglunid){
            let arr = []
            for(let i in this.pinglunlist){
              arr.push(this.pinglunlist[i].id)
            }
            if(!arr.includes(all2.pinglunid)){
              all2.pinglunid = ''
            }
          }

          this.all2.min_page = all2.min_page
          this.all2.max_page = all2.max_page
          this.all2.pinglunid = all2.pinglunid

          this.all2.xiadanshuliang = all2.xiadanshuliang
          this.all2.needage = all2.needage
          this.all2.guozhengtong = all2.guozhengtong
          this.all2.zuidaxiadan = all2.zuidaxiadan
          this.all2.duanxin = all2.duanxin
          this.all2.shouhuorenxingming = all2.shouhuorenxingming
          this.all2.shenfenzheng = all2.shenfenzheng
          this.all2.bufahuodiqu = all2.bufahuodiqu
          this.all2.delivery_city = all2.delivery_city
          this.all2.no_city = all2.no_city
          this.all2.bufahuosheng = all2.bufahuosheng
          this.all2.xiantianxie = all2.xiantianxie
          this.all2.needidcard = all2.needidcard
          this.all2.ruwangxieyi = all2.ruwangxieyi
          this.all2.gongsiming = all2.gongsiming
          this.all2.gongsidizhi = all2.gongsidizhi
          this.all2.gongsidianhua = all2.gongsidianhua
          this.all2.dingdanzhuangtai = all2.dingdanzhuangtai
          this.all2.kuaishou = all2.kuaishou
          this.all2.pinglun = all2.pinglun
          this.all2.neirongcolor = all2.neirongcolor
          this.all2.anniucolor = all2.anniucolor
          this.all2.anniuwenzi = all2.anniuwenzi
          this.all2.yansename = all2.yansename
          this.all2.yueduyanse = all2.yueduyanse
          this.all2.gm = all2.gm

        })
      },
      yanseshow:function(){
        this.$refs.yansexuanze.log = true
      },
      yansexuanze:function(item){
        let val = item.yanse
        this.all2.yuanjiao = item.yuanjiao
        if(val == 1){
          this.all2.neirongcolor = "rgb(246, 194, 31)"
          this.all2.anniucolor = "rgb(168, 50, 252)"
          this.all2.yueduyanse = "rgb(99, 65, 0)"
          this.all2.yansename = "黄色"
        }
        if(val == 2){
          this.all2.neirongcolor = "rgb(0, 190, 190)"
          this.all2.anniucolor = "rgb(255, 220, 54)"
          this.all2.yueduyanse = "rgb(0, 73, 89)"
          this.all2.yansename = "初音绿"
        }
        if(val == 3){
          this.all2.neirongcolor = "rgb(0, 13, 190)"
          this.all2.anniucolor = "rgb(255, 67, 7)"
          this.all2.yueduyanse = "rgb(255, 173, 19)"
          this.all2.yansename = "蓝色"
        }
        if(val == 4){
          this.all2.neirongcolor = "rgb(0, 190, 66)"
          this.all2.anniucolor = "rgb(255, 212, 7)"
          this.all2.yueduyanse = "rgb(0, 106, 4)"
          this.all2.yansename = "绿色"
        }
        if(val == 5){
          this.all2.neirongcolor = "rgb(255, 63, 123)"
          this.all2.anniucolor = "rgb(255, 212, 7)"
          this.all2.yueduyanse = "rgb(80, 5, 52)"
          this.all2.yansename = "粉红色"
        }
        if(val == 6){
          this.all2.neirongcolor = "rgb(255, 63, 63)"
          this.all2.anniucolor = "rgb(255, 212, 7)"
          this.all2.yueduyanse = "rgb(71, 13, 13)"
          this.all2.yansename = "红色"
        }
        if(val == 7){
          this.all2.neirongcolor = "rgb(63, 116, 255)"
          this.all2.anniucolor = "rgb(255, 193, 0)"
          this.all2.yueduyanse = "rgb(21, 22, 124)"
          this.all2.yansename = "浅蓝色"
        }
        if(val == 8){
          this.all2.neirongcolor = "rgb(157, 111, 255)"
          this.all2.anniucolor = "rgb(255, 64, 33)"
          this.all2.yueduyanse = "rgb(66, 6, 93)"
          this.all2.yansename = "紫色"
        }
		if(val == 9){
		  this.all2.neirongcolor = "rgb(255, 255, 255)"
		  this.all2.anniucolor = "rgb(255, 60, 60)"
		  this.all2.yueduyanse = "rgb(0, 126, 255)"
		  this.all2.yansename = "白色"
		}
		if(val == 10){
		  this.all2.neirongcolor = "rgb(0, 0, 0)"
		  this.all2.anniucolor = "#FFBC41"
		  this.all2.yueduyanse = "#FDC96A"
		  this.all2.yansename = "黑色"
		}
      },
      xuanzeshuliang2:function(){
        if(this.all2.xiadanshuliang == 0){
          this.all.limit = ""
        }
      },
      xuanzeshuliang:function(){
        // if(this.all.limit == 0){
        //   this.all.xiadanshuliang = false
        // }else{
        //   this.all.xiadanshuliang = true
        // }
      },
      shifouxianshixieyi2:function(){
        if(this.all.network_access_protocol == 0){
          this.all.protocol_id = []
        }
      },
      shifouxianshixieyi:function(){
        if(this.all.protocol_id != 0){
          this.all.network_access_protocol = "1"
        }
      },
      xuanzeshangpinkai:function(){

        this.fuzhixinxi = false
        this.log_shop = true
      },
      xuanzeshangpinkai2:function(){
        this.fuzhixinxi = true
        this.log_shop = true
      },

      getchanpinxixi:function(page_id){

        axios.get(`${this.apis}/api/product/info?page_id=${page_id}`)
          .then(response => {
            if(response.data.msg.code == 0){
              this.chanpinxixi = response.data.data
              if(this.chanpinxixi.real_name_type == 0){

                this.xiaozi = true
              }else{

                this.xiaozi = false
              }

            }else{
              this.$message.error(response.data.msg.info);
            }
          });
      },
      fuwenbenfanhui:function(html){
        this.all.description = html
      },
      getshangpinfenlei:function(){
        axios.get(`${this.apis}/api/comment/template/list`)
          .then(response => {
            if(response.data.msg.code == 0){
              this.pinglunlist = response.data.data
            }else{
              this.$message.error(response.data.msg.info);
            }
          });

        axios.get(`${this.apis}/api/network-process-protocol/list`)
          .then(response => {
            if(response.data.msg.code == 0){
              this.xieyilist = response.data.data
            }else{
              this.$message.error(response.data.msg.info);
            }
          });
      },
      upup:function(file){
        var params = new FormData();
        params.append('file',file.file);
        axios.post(`${this.apis}/api/delivery/data`, params)
          .then(response=> {
              if (response.data.msg.code == 0) {
                this.all2.bufahuodiqu = '1'
                this.all2.delivery_city = response.data.data
              }else{
                  this.$message.error(response.data.msg.info);
              }
          })
      },
      down:function(){
              const a = document.createElement('a');
            	a.setAttribute('download', '不发货省市区.xlsx');
            	a.setAttribute('href', '/web/static/bufahuoshengshiqu.xlsx');
            	a.click();
      },
      test:function(){
        this.all2.bufahuosheng = []
        let checkedNodeList = this.$refs.test.getCheckedNodes();
        console.log(checkedNodeList)
        checkedNodeList = checkedNodeList.filter(item => (item.parent == null && item.checked)); // 核心
        checkedNodeList.forEach(item=>{
          this.all2.bufahuosheng.push(item.value)
        })
      },
      xuanzhong2:function(item){

      },


      fabu:function(){
        if(this.all.pages == '' || !this.all.pages[0].page_id){
          this.$message.error('请选择要提交的商品');
          return false
        }
        if(!this.all.sale_name){
          this.$message.error('请输入页面名称');
          return false
        }

        this.all.pages = this.all.pages.filter(item => item.page_id)

        this.all.pages.forEach(item=>{
          if(item.unit_price == ''){
            item.unit_price = 0
          }
        })

        this.all.page_name = this.all.pages[0].page_name2

        if(this.all2.needidcard=='2'){
          this.all.limit_type = this.limit_type2
        }else{
          this.all.limit_type = this.limit_type1
        }
        if(this.all2.needidcard=='1'){
          this.all.limit_type = this.limit_type1
        }
this.all.sell_point = JSON.stringify(this.all.sell_point2)

        this.all.guozhengtong  =  this.all2.guozhengtong

         axios.post(`${this.apis}/api/page/make2`,this.all)
              .then(response => {
                if (response.data.msg.code == 0) {
                    var that = this
                    let id = this.$route.query.id ? this.$route.query.id : response.data.data.id
                    var Obj2str = function(o) {
                        if (o == undefined) {
                            return "";
                        }
                        var r = [];
                        if (typeof o == "string") return "\"" + o.replace(/([\"\\])/g, "\\$1").replace(/(\n)/g, "\\n").replace(/(\r)/g, "\\r").replace(/(\t)/g, "\\t") + "\"";
                        if (typeof o == "object") {
                            if (!o.sort) {
                                for (var i in o)
                                    r.push("\"" + i + "\":" + Obj2str(o[i]));
                                if (!!document.all && !/^\n?function\s*toString\(\)\s*\{\n?\s*\[native code\]\n?\s*\}\n?\s*$/.test(o.toString)) {
                                    r.push("toString:" + o.toString.toString());
                                }
                                r = "{" + r.join() + "}"
                            } else {
                                for (var i = 0; i < o.length; i++)
                                    r.push(Obj2str(o[i]));
                                r = "[" + r.join() + "]";
                            }
                            return r;
                        }
                        return o.toString().replace(/\"\:/g, '":""');
                    }


                    let wenjianjia = 'web-page'
                    if(process.env.NODE_ENV === 'development'){
                      // wenjianjia = 'test-web-page'
                    }
                    if(window.location.href.includes('storep.91haoka.cn') && this.apis == ''){
                      wenjianjia = 'web-page'
                    }
                    if(window.location.href.includes('store.91haoka.cn') && this.apis == ''){
                      wenjianjia = 'test-web-page'
                    }
                    if(window.location.href.includes('localhost')){
                      wenjianjia = 'test-web-page'
                    }

                    axios.post(`${this.apis}/api/qiniu/token`,{bucket:'gthshopstore',cloud:`${wenjianjia}/${id}.json`})
                      .then(response => {

                        if(response.data.msg.code == 0){
                          const observer = {
                            next(res){

                            },
                            error(err){

                            },
                            complete(res){

                              that.$message.success('发布成功');
                              // that.goid('/zhiboxitong/zhiboxiaoshou/zhiboxiaoshou_shangpin',this.$route.query.tab)
                              that.$router.push({
                                path:'/zhiboxitong/meitituiguang/meitituiguang_fabu2',
                                query:{
                                  id:id,
                                  duo:1
                                }
                              })
                            }
                          }

                          let files = Obj2str(JSON.stringify(this.all2))
                          let file = new File([files], `${wenjianjia}/${id}.json`, {type: 'application/json'});
                          const observable = qiniu.upload(file, file.name, response.data.data, {}, {})
                          const subscription = observable.subscribe(observer) // 上传开始
                        }else{
                          this.$message.error(response.data.msg.info);
                        }
                      });

                    // let id = this.$route.query.id ? this.$route.query.id : response.data.data.id


                    //  let data = {
                    //    id:id,//	是	string	销售页的id
                    //    type:"json",//	是	string	css json 等 文件的后缀本示例为 5.css
                    //    data:JSON.stringify(this.all2),//	是	array	要存的数据 到时候访问id.type(5.css)返回的就是data里的数据
                    //    path:"page",//	否	string	store 店铺用的 page 商品用的
                    //  }
                    //  axios.post(`${this.apis}/api/page/json`,data)
                    //       		.then(response => {
                    //       			if (response.data.msg.code == 0) {
                    //               this.$router.push({
                    //                 path:'/zhiboxitong/meitituiguang/meitituiguang_fabu2',
                    //                 query:{
                    //                   id:id
                    //                 }
                    //               })
                    //       			} else {
                    //       				this.$message.error(response.data.msg.info);
                    //       			}
                    //       	})

                } else {
                    this.$message.error(response.data.msg.info);
                }
            })

      },
      getimg:function(img){
        this.all.pic = img
      },
      getimg2:function(img){
        this.all.details = img
      },
      getimg3:function(img){
        this.all.market_pic = img
      },
      xiayibu:function(){
        this.goid('/zhiboxitong/zhiboxiaoshou_fabu2')
      },
      //获取商品
      getshops:async function() {
      	await axios.get(`${this.apis}/api/order-page/list`,{
          params:this.shopsearch
        })
      		.then(response => {
      			if (response.data.msg.code == 0) {
      				this.shoplists = response.data.data

      			} else {
      				this.$message.error(response.data.msg.info);
      			}
      		})
      },
      //当前是否需要身份证
      isneedcard(e){
        console.log(e)
        //选择了不需要身份证
        if(e==2){
          //国政通取消
          this.all2.guozhengtong=false
          //收货人使用身份证姓名取消
          this.all2.shouhuorenxingming=false
          this.all2.needage = false
          this.all2.min_page = ""
          this.all2.max_page = ""
        }
      }

    }
  }
</script>

<style scoped lang="less">
  .meitituiguang_fabu {
    background: #f2f2f2; color: #333;
    min-height: 100vh;
    /deep/ .el-select {
      .el-select__caret:before {
        content: '\e790';

      }
    }
    /deep/ .el-select .el-input .el-select__caret {
      transform: rotateZ(0deg);
    }
    /deep/ .el-input__inner{ border-color: rgb(191, 191, 191);}
    /deep/ .youse .el-input__inner{ }
    /deep/ .el-switch .el-switch__core{ height: 18px !important; width: 36px !important;
          border-color:rgb(69, 69, 69) !important;
          background-color: rgb(255, 255, 255) !important;
          &::after{
            background-color: rgb(69, 69, 69);
            width: 14px;
            height: 14px;
          }
    }
    /deep/ .is-checked .el-switch__core{
          border-color: rgb(71, 140, 253) !important; height: 18px !important; width: 36px !important;
          background-color: rgb(71, 140, 253) !important;
          &::after{
            background-color: rgb(255, 255, 255);
            width: 14px;
            height: 14px;
          }
    }
    /deep/ .w-e-toolbar{ z-index: 11 !important;}
    /deep/ .w-e-text-container{ z-index: 10 !important;}
    /deep/ .el-breadcrumb{ font-size: 16px;}
    ::-webkit-scrollbar {
      /*滚动条整体样式*/
      width: 1px; /*高宽分别对应横竖滚动条的尺寸*/
      height: 1px;
    }
    ::-webkit-scrollbar-thumb {
      /*滚动条里面小方块*/
      border-radius: 10px;
      box-shadow: inset 0 0 5px rgba(97, 184, 179, 0.1);
      background: #eee;
    }
    ::-webkit-scrollbar-track {
      /*滚动条里面轨道*/
      box-shadow: inset 0 0 5px rgba(87, 175, 187, 0.1);
      border-radius: 10px;
      background: #fff;
    }
    *{ box-sizing: border-box;}
    .zhiboxitong_content{
      height: calc(100vh - 70px);
      .left{width: 210px;background: #FAFAFE;height: 100%;}
      .right{ width: calc(100vw - 217px);padding: 10px;
        .zhiboxitong_right{
           height: calc(100vh - 90px); overflow: auto; background: #fff; border-radius: 5px; padding: 20px;
        }
        .xiaright{
          width: 300px; height: 700px; background: url('https://static.91haoka.cn/gantanhao/shouji3.png');background-size: 300px 700px; padding: 50px 20px;
          img{ width: 100%;}
        }
        .fleft{
          padding-top: 50px;
          .ft{ font-size: 18px;margin-bottom: 30px;font-weight: bold;}
          .z{width: 120px;text-align: right;padding-right: 20px; font-size: 14px;}
          .r{}
        }
        .buzhou{ padding: 50px;}
      }
    }

    .flex {
      display: flex;
      flex-wrap: wrap;
    }

    .flexb {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
    }

    .flexc {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
    }

    .flexbc {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
    }

    .flexcc {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
    }
  }
</style>
